Skip to content

Add semantic-non-null support to CLI and snapshot tests#9611

Merged
tobias-tengler merged 2 commits intomainfrom
tte/allow-for-semantic-null-export-in-more-places
Apr 28, 2026
Merged

Add semantic-non-null support to CLI and snapshot tests#9611
tobias-tengler merged 2 commits intomainfrom
tte/allow-for-semantic-null-export-in-more-places

Conversation

@tobias-tengler
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 28, 2026 13:45
@github-actions github-actions Bot added 📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate labels Apr 28, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a --semantic-non-null schema export path that rewrites SDL output fields from non-null wrappers to @semanticNonNull annotations, and wires this through formatting/export surfaces (CLI, HTTP schema endpoint) with updated docs/tests.

Changes:

  • Add SchemaFormatterOptions.RewriteToSemanticNonNull and apply it inside SchemaFormatter.
  • Add CLI --semantic-non-null option to schema export, routing through SchemaFileExporter.
  • Update/move semantic-non-null rewriter namespace and add/adjust snapshots + tests.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md Documents removal of runtime semantic-non-null behavior in v16 and explains how to still emit annotated SDL via formatter/endpoint/CLI.
src/HotChocolate/Core/test/Types.Abstractions.Tests/Serialization/SemanticNonNullSchemaRewriterTests.cs Updates test namespace/imports to match rewriter move.
src/HotChocolate/Core/src/Types/Execution/Internal/SchemaFileExporter.cs Adds semantic-non-null rewrite support to schema file export (used by CLI).
src/HotChocolate/Core/src/Types.Abstractions/Serialization/SemanticNonNullSchemaRewriter.cs Moves rewriter into HotChocolate.Serialization namespace.
src/HotChocolate/Core/src/Types.Abstractions/Serialization/SchemaFormatterOptions.cs Adds RewriteToSemanticNonNull formatter option.
src/HotChocolate/Core/src/Types.Abstractions/Serialization/SchemaFormatter.cs Applies RewriteToSemanticNonNull post-processing during schema formatting.
src/HotChocolate/Core/src/Types.Abstractions/HotChocolate.Types.Abstractions.csproj Adds InternalsVisibleTo for HotChocolate.Types.Abstractions.Tests.
src/HotChocolate/AspNetCore/test/AspNetCore.CommandLine.Tests/snapshots/SchemaExportCommandTests.App_Should_WriteSemanticNonNullSchemaToFile_When_SemanticNonNullOptionIsSpecified.md New snapshot validating semantic-non-null schema export output.
src/HotChocolate/AspNetCore/test/AspNetCore.CommandLine.Tests/snapshots/SchemaExportCommandTests.App_Should_OutputCorrectHelpTest_When_HelpIsRequested.snap Updates CLI help snapshot with the new option.
src/HotChocolate/AspNetCore/test/AspNetCore.CommandLine.Tests/SchemaExportCommandTests.cs Adds test coverage for --semantic-non-null export.
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Formatters/DefaultHttpResponseFormatter.cs Switches semantic-non-null schema output to use SchemaFormatter option instead of manual rewrite.
src/HotChocolate/AspNetCore/src/AspNetCore.CommandLine/Options/SemanticNonNullOption.cs Introduces the new CLI option definition.
src/HotChocolate/AspNetCore/src/AspNetCore.CommandLine/Command/ExportCommand.cs Wires the new option into schema export and passes it to the exporter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants